home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TPUG - Toronto PET Users Group
/
TPUG Users Group CD
/
TPUG Users Group CD.iso
/
COMAL
/
A-COMAL Series
/
(k)aab.d64
/
lst.graphs
< prev
next >
Wrap
Text File
|
2007-02-28
|
7KB
|
228 lines
0010 // DELETE "0:LST.GRAPHS"
0020 // LIST "0:LST.GRAPHS"
0030
0040 ╨╥╧├ INIT
0050 ╒╙┼ SYSTEM
0060 ╒╙┼ GRAPHICS
0070
0080 GRAPHICSCREEN(0)
0090 BORDER(1)
0100 BACKGROUND(1)
0110 PENCOLOR(11)
0120 HIDETURTLE
0130 VIEWPORT(0,319,0,199)
0140 MIN'WL:=6; MAX'WL:=150
0150 MIN'FLUX:=1; MAX'FLUX:=1000000
0160 MIN'X:=LOG10(MIN'WL); MAX'X:=LOG10(MAX'WL)
0170 MIN'Y:=LOG10(MIN'FLUX); MAX'Y:=LOG10(MAX'FLUX)
0180 WINDOW(MIN'X,MAX'X,MIN'Y,MAX'Y)
0190 DRAW'BOX(╘╥╒┼,╘╥╒┼,╘╥╒┼,╘╥╒┼)
0200 ┼╬─╨╥╧├ INIT
0210
0220 ╨╥╧├ DRAW'BOX(BOTTOM,LEFT'SIDE,RIGHT'SIDE,TOP) ├╠╧╙┼─
0230 ╔═╨╧╥╘ AXIS,LOG'AXIS,MOVETO,DRAWTO,INQ
0240 XMIN:=INQ(23); XMAX:=INQ(24); YMIN:=INQ(25); YMAX:=INQ(26)
0250 ╔╞ BOTTOM=1 ╘╚┼╬
0260 LOG'AXIS(XMIN,YMIN,XMAX,YMIN,XMIN,XMAX)
0270 ┼╠╔╞ BOTTOM=0 ╘╚┼╬
0280 AXIS(XMIN,YMIN,XMAX,YMIN,XMIN,XMAX)
0290 ┼╠╙┼
0300 MOVETO(XMIN,YMIN)
0310 DRAWTO(XMAX,YMIN)
0320 ┼╬─╔╞
0330 ╔╞ LEFT'SIDE=0 ╘╚┼╬
0340 AXIS(XMIN,YMIN,XMIN,YMAX,YMIN,YMAX)
0350 ┼╠╔╞ LEFT'SIDE=1 ╘╚┼╬
0360 LOG'AXIS(XMIN,YMIN,XMIN,YMAX,YMIN,YMAX)
0370 ┼╠╙┼
0380 MOVETO(XMIN,YMIN)
0390 DRAWTO(XMIN,YMAX)
0400 ┼╬─╔╞
0410 ╔╞ RIGHT'SIDE=0 ╘╚┼╬
0420 AXIS(XMAX,YMIN,XMAX,YMAX,YMIN,YMAX)
0430 ┼╠╔╞ RIGHT'SIDE=1 ╘╚┼╬
0440 LOG'AXIS(XMAX,YMIN,XMAX,YMAX,YMIN,YMAX)
0450 ┼╠╙┼
0460 MOVETO(XMAX,YMIN)
0470 DRAWTO(XMAX,YMAX)
0480 ┼╬─╔╞
0490 ╔╞ TOP=0 ╘╚┼╬
0500 AXIS(XMIN,YMAX,XMAX,YMAX,XMIN,XMAX)
0510 ┼╠╔╞ TOP=1 ╘╚┼╬
0520 LOG'AXIS(XMIN,YMAX,XMAX,YMAX,XMIN,XMAX)
0530 ┼╠╙┼
0540 MOVETO(XMIN,YMAX)
0550 DRAWTO(XMAX,YMAX)
0560 ┼╬─╔╞
0570 ┼╬─╨╥╧├ DRAW'BOX
0580
0590 ╞╒╬├ LOG10(NUM) ├╠╧╙┼─
0600 ╥┼╘╒╥╬ ╠╧╟(NUM)/╠╧╟(10)
0610 ┼╬─╞╒╬├ LOG10
0620
0630 ╞╒╬├ MAX(A,B) ├╠╧╙┼─
0640 ╔╞ A>B ╘╚┼╬
0650 ╥┼╘╒╥╬ A
0660 ┼╠╙┼
0670 ╥┼╘╒╥╬ B
0680 ┼╬─╔╞
0690 ┼╬─╞╒╬├ MAX
0700
0710 ╞╒╬├ MIN(A,B) ├╠╧╙┼─
0720 ╔╞ A<B ╘╚┼╬
0730 ╥┼╘╒╥╬ A
0740 ┼╠╙┼
0750 ╥┼╘╒╥╬ B
0760 ┼╬─╔╞
0770 ┼╬─╞╒╬├ MIN
0780
0790 ╨╥╧├ AXIS(START'X,START'Y,STOP'X,STOP'Y,START'VL,STOP'VL) ├╠╧╙┼─
0800 ╔═╨╧╥╘ MOVETO,DRAWTO,INQ,TICKS,BASE'CONV,PLOTTEXT,MIN
0810 ─╔═ OUT$ ╧╞ 10
0820 MOVETO(START'X,START'Y)
0830 DRAWTO(STOP'X,STOP'Y)
0840 DX:=STOP'X-START'X; DY:=STOP'Y-START'Y
0850 RANGE:=STOP'VL-START'VL
0860 X'RATIO:=DX/RANGE; Y'RATIO:=DY/RANGE
0870 XMIN:=INQ(23); XMAX:=INQ(24); YMIN:=INQ(25); YMAX:=INQ(26)
0880 X'SCALE:=(INQ(20)-INQ(19))/(XMAX-XMIN)
0890 Y'SCALE:=(INQ(22)-INQ(21))/(YMAX-YMIN)
0900 X'LN:=DX*X'SCALE; Y'LN:=DY*Y'SCALE
0910 LENGTH:=╙╤╥(X'LN^2+Y'LN^2)
0920 ALPHA:=X'LN/LENGTH; BETA:=Y'LN/LENGTH
0930 DELTA:=(STOP'VL-START'VL)*75/LENGTH
0940 TICKS(START'VL,STOP'VL,DELTA,I'START,I'STOP,NUMBER'SIZE)
0950 ╔╞ (START'X-XMIN<XMAX-STOP'X) ╧╥ (START'Y-YMIN>YMAX-STOP'Y) ╘╚┼╬
0960 SIDE#:=+1
0970 ┼╠╙┼
0980 SIDE#:=-1
0990 ┼╬─╔╞
1000 ╞╧╥ I:=I'START ╘╧ I'STOP ╙╘┼╨ ╙╟╬(LENGTH) ─╧
1010 VALUE:=I*DELTA
1020 X:=START'X+(VALUE-START'VL)*X'RATIO
1030 Y:=START'Y+(VALUE-START'VL)*Y'RATIO
1040 MOVETO(X,Y)
1050 X:=X+SIDE#*(8/X'SCALE)*BETA
1060 Y:=Y-SIDE#*(8/Y'SCALE)*ALPHA
1070 DRAWTO(X,Y)
1080 BASE'CONV(VALUE,10,OUT$)
1090 X:=X-(4/X'SCALE)*NUMBER'SIZE*(1-SIDE#)*BETA
1100 ╔╞ DY<>0 ╘╚┼╬ X:=X-(8/X'SCALE)*ALPHA/BETA
1110 Y:=Y-(4/Y'SCALE)*(SIDE#+1)*ALPHA
1120 PLOTTEXT(X,Y,OUT$(1:MIN(NUMBER'SIZE,╠┼╬(OUT$))))
1130 ┼╬─╞╧╥ I
1140 ┼╬─╨╥╧├ AXIS
1150
1160 ╨╥╧├ BASE'CONV(DCML,BASE,╥┼╞ OUTPT$) ├╠╧╙┼─
1170 ╔═╨╧╥╘ MAX
1180 ─╔═ DIGIT$ ╧╞ 16
1190 DIGIT$:="0123456789ABCDEF"
1200 ╔╞ DCML ╘╚┼╬
1210 ╔╞ DCML>0 ╘╚┼╬
1220 OUTPT$:=""
1230 ┼╠╙┼
1240 OUTPT$:="-"
1250 ┼╬─╔╞
1260 REMNDR:=┴┬╙(DCML)
1270 LB#:=╔╬╘(╠╧╟(REMNDR)/╠╧╟(BASE))
1280 DVSR:=MAX(BASE^LB#,.1)
1290 ╫╚╔╠┼ DVSR>=1 ─╧
1300 DIGT:=╔╬╘(REMNDR/DVSR+1E-05)
1310 OUTPT$:=OUTPT$+DIGIT$(DIGT+1)
1320 REMNDR:=REMNDR-DVSR*╔╬╘(DIGT)
1330 DVSR:=DVSR/BASE
1340 ┼╬─╫╚╔╠┼
1350 ╔╞ REMNDR ╘╚┼╬ OUTPT$:=OUTPT$+"."
1360 ╫╚╔╠┼ REMNDR>0 ┴╬─ DVSR>0 ─╧
1370 DIGT:=╔╬╘(REMNDR/DVSR+1E-05)
1380 OUTPT$:=OUTPT$+DIGIT$(DIGT+1)
1390 REMNDR:=REMNDR-DVSR*╔╬╘(DIGT)
1400 DVSR:=DVSR/BASE
1410 ┼╬─╫╚╔╠┼
1420 ┼╠╙┼
1430 OUTPT$:=DIGIT$(1)
1440 ┼╬─╔╞
1450 ┼╬─╨╥╧├ BASE'CONV
1460
1470 ╨╥╧├ TICKS(LFT'LO,RGHT'HI,╥┼╞ INTVL,╥┼╞ ISTART,╥┼╞ ISTOP,╥┼╞ N'S) ├╠╧╙┼─
1480 ╔═╨╧╥╘ LOG10,MAX
1490 INTVL'EXPNT:=LOG10(INTVL)
1500 INTVL'ORDER'MAGN:=╔╬╘(INTVL'EXPNT)
1510 INTVL'MANTISSA:=INTVL*10^(-INTVL'ORDER'MAGN)
1520 ╔╞ INTVL'MANTISSA<1.5 ╘╚┼╬
1530 INTVL'MANTISSA:=1
1540 ┼╠╔╞ INTVL'MANTISSA<3 ╘╚┼╬
1550 INTVL'MANTISSA:=2
1560 ┼╠╔╞ INTVL'MANTISSA<8 ╘╚┼╬
1570 INTVL'MANTISSA:=5
1580 ┼╠╙┼
1590 INTVL'MANTISSA:=10
1600 ┼╬─╔╞
1610 INTVL:=INTVL'MANTISSA*10^INTVL'ORDER'MAGN
1620 ISTART:=╔╬╘(LFT'LO/INTVL); ISTOP:=╔╬╘(RGHT'HI/INTVL)
1630 ╔╞ ISTOP>ISTART ╘╚┼╬
1640 ╔╞ ISTART*INTVL<LFT'LO ╘╚┼╬ ISTART:=ISTART+1
1650 ╔╞ ISTOP*INTVL>RGHT'HI ╘╚┼╬ ISTOP:=ISTOP-1
1660 ┼╠╙┼
1670 ╔╞ ISTOP*INTVL<RGHT'HI ╘╚┼╬ ISTOP:=ISTOP+1
1680 ┼╬─╔╞
1690 NUM'DIGITS'GT'0:=┴┬╙(╔╬╘(LOG10(MAX(┴┬╙(RGHT'HI),┴┬╙(LFT'LO)))))+1
1700 INTVL'NUM'DIGITS:=┴┬╙(INTVL'ORDER'MAGN)
1710 ╔╞ INTVL'ORDER'MAGN<0 ╘╚┼╬
1720 ╔╞ INTVL'NUM'DIGITS>0 ╘╚┼╬
1730 N'S:=NUM'DIGITS'GT'0+INTVL'NUM'DIGITS+1
1740 ┼╠╙┼
1750 N'S:=NUM'DIGITS'GT'0
1760 ┼╬─╔╞
1770 ┼╠╙┼
1780 N'S:=NUM'DIGITS'GT'0
1790 ┼╬─╔╞
1800 ┼╬─╨╥╧├ TICKS
1810
1820 ╨╥╧├ LOG'AXIS(START'X,START'Y,STOP'X,STOP'Y,START'VL,STOP'VL) ├╠╧╙┼─
1830 ╔═╨╧╥╘ MOVETO,DRAWTO,INQ,TICKS,BASE'CONV,PLOTTEXT,MIN,LOG10
1840 ─╔═ OUT$ ╧╞ 10
1850 MOVETO(START'X,START'Y)
1860 DRAWTO(STOP'X,STOP'Y)
1870 DX:=STOP'X-START'X; DY:=STOP'Y-START'Y
1880 RANGE:=STOP'VL-START'VL
1890 X'RATIO:=DX/RANGE; Y'RATIO:=DY/RANGE
1900 XMIN:=INQ(23); XMAX:=INQ(24); YMIN:=INQ(25); YMAX:=INQ(26)
1910 X'SCALE:=(INQ(20)-INQ(19))/(XMAX-XMIN)
1920 Y'SCALE:=(INQ(22)-INQ(21))/(YMAX-YMIN)
1930 X'LN:=DX*X'SCALE; Y'LN:=DY*Y'SCALE
1940 LENGTH:=╙╤╥(X'LN^2+Y'LN^2)
1950 ALPHA:=X'LN/LENGTH; BETA:=Y'LN/LENGTH
1960 I'START:=╔╬╘(START'VL); I'STOP:=╔╬╘(STOP'VL)+1
1970 ╔╞ (START'X-XMIN<XMAX-STOP'X) ╧╥ (START'Y-YMIN>YMAX-STOP'Y) ╘╚┼╬
1980 SIDE#:=+1
1990 ┼╠╙┼
2000 SIDE#:=-1
2010 ┼╬─╔╞
2020 ╞╧╥ I:=I'START ╘╧ I'STOP ─╧
2030 ╞╧╥ J:=1 ╘╧ 9 ─╧
2040 VALUE:=LOG10(J*10^I)
2050 X:=START'X+(VALUE-START'VL)*X'RATIO
2060 Y:=START'Y+(VALUE-START'VL)*Y'RATIO
2070 MOVETO(X,Y)
2080 X:=X+SIDE#*(8/X'SCALE)*BETA
2090 Y:=Y-SIDE#*(8/Y'SCALE)*ALPHA
2100 DRAWTO(X,Y)
2110 ╔╞ J=1 ╘╚┼╬
2120 BASE'CONV(VALUE,10,OUT$)
2130 ╔╞ VALUE=0 ╘╚┼╬
2140 NUMBER'SIZE:=1
2150 ┼╠╔╞ VALUE>0 ╘╚┼╬
2160 NUMBER'SIZE:=╔╬╘(LOG10(VALUE))+1
2170 ┼╠╙┼
2180 NUMBER'SIZE:=╔╬╘(LOG10(┴┬╙(VALUE)))+2
2190 ┼╬─╔╞
2200 X:=X-(4/X'SCALE)*NUMBER'SIZE*(1-SIDE#)*BETA
2210 ╔╞ DY<>0 ╘╚┼╬ X:=X-(8/X'SCALE)*ALPHA/BETA
2220 Y:=Y-(4/Y'SCALE)*(SIDE#+1)*ALPHA
2230 PLOTTEXT(X,Y,OUT$(1:MIN(NUMBER'SIZE,╠┼╬(OUT$))))
2240 ┼╬─╔╞
2250 ┼╬─╞╧╥ J
2260 ┼╬─╞╧╥ I
2270 ┼╬─╨╥╧├ LOG'AXIS